package com.yhg.qxmall.cartorder.controller;

import java.util.Arrays;
import java.util.Map;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.yhg.qxmall.cartorder.entity.FmsOrderItemEntity;
import com.yhg.qxmall.cartorder.service.FmsOrderItemService;
import com.yhg.common.utils.PageUtils;
import com.yhg.common.utils.R;



/**
 * 订单项信息
 *
 * @author 凌月青缃
 * @email 13@qxmall.com
 * @date 2020-12-22 14:08:53
 */
@RestController
@RequestMapping("cartorder/orderitem")
public class FrontOrderItemController {
    @Autowired
    private FmsOrderItemService fmsOrderItemService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = fmsOrderItemService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
		FmsOrderItemEntity fmsOrderItem = fmsOrderItemService.getById(id);

        return R.ok().put("fmsOrderItem", fmsOrderItem);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody FmsOrderItemEntity fmsOrderItem){
		fmsOrderItemService.save(fmsOrderItem);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody FmsOrderItemEntity fmsOrderItem){
		fmsOrderItemService.updateById(fmsOrderItem);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
		fmsOrderItemService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
